package com.pai4j.domain.vo.response.group;

import lombok.Data;

import java.io.Serializable;

/**
 * 加群响应VO
 * 支持多种加群结果：直接加入、提交审批、被拒绝等
 */
@Data
public class JoinGroupResponseVO implements Serializable {

    /**
     * 加群结果状态
     * 1-成功加入
     * 2-已提交审批申请
     * 3-群已满
     * 4-已在群内
     * 5-群禁止加入
     */
    private Integer status;

    /**
     * 结果描述
     */
    private String message;

    /**
     * 申请ID（当status=2时有值）
     */
    private Long applicationId;

    /**
     * 群组ID
     */
    private String groupPaiId;

    /**
     * 用户账号
     */
    private String userAccount;

    /**
     * 便捷方法：创建成功加入响应
     */
    public static JoinGroupResponseVO success(String groupPaiId, String userAccount) {
        JoinGroupResponseVO vo = new JoinGroupResponseVO();
        vo.setStatus(1);
        vo.setMessage("成功加入群聊");
        vo.setGroupPaiId(groupPaiId);
        vo.setUserAccount(userAccount);
        return vo;
    }

    /**
     * 便捷方法：创建审批中响应
     */
    public static JoinGroupResponseVO pending(String groupPaiId, String userAccount, Long applicationId) {
        JoinGroupResponseVO vo = new JoinGroupResponseVO();
        vo.setStatus(2);
        vo.setMessage("加群申请已提交，请等待审批");
        vo.setApplicationId(applicationId);
        vo.setGroupPaiId(groupPaiId);
        vo.setUserAccount(userAccount);
        return vo;
    }

    /**
     * 便捷方法：创建失败响应
     */
    public static JoinGroupResponseVO failed(String groupPaiId, String userAccount, Integer status, String message) {
        JoinGroupResponseVO vo = new JoinGroupResponseVO();
        vo.setStatus(status);
        vo.setMessage(message);
        vo.setGroupPaiId(groupPaiId);
        vo.setUserAccount(userAccount);
        return vo;
    }
}
